package com.example.javabasic.thread.classone.demo4;

public class OtherService {


    private final Object lock = new Object();
    private DeadLock deadLock;

    public OtherService(DeadLock deadLock) {
        this.deadLock = deadLock;
    }

    public void s1(){
        synchronized (lock){
            System.out.println("OtherService-s1");
        }
    }

    public void s2(){
        synchronized (lock){
            System.out.println("OtherService-s2");
            deadLock.m2();
        }
    }
}
